package com.cvmars.jianyou.module.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.animation.AlphaAnimation;
import android.widget.RelativeLayout;

import com.cvmars.jianyou.R;
import com.cvmars.jianyou.model.UserInfoManager;
import com.cvmars.jianyou.module.base.BaseActivity;
import com.qmuiteam.qmui.util.QMUIStatusBarHelper;

import butterknife.BindView;
import butterknife.ButterKnife;

public class WelcomeLoginActivity extends BaseActivity {
    @BindView(R.id.rl_bottom)
    RelativeLayout rlBottom;

//    @BindView(R.id.partview)
//    ParticleView partview;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome_login);
        ButterKnife.bind(this);
        QMUIStatusBarHelper.translucent(this);

//        partview.startAnim();
//
//        partview.setOnParticleAnimListener(new ParticleView.ParticleAnimListener() {
//            @Override
//            public void onAnimationEnd() {
//
//

        AlphaAnimation alpha = new AlphaAnimation(0.5F, 1f);
        alpha.setDuration(1500);
        alpha.setFillAfter(true);
        rlBottom.startAnimation(alpha);

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {

                WelcomeLoginActivity.this.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {


                        if (UserInfoManager.getInstance().isUserLogin()) {

                            startActivity(new Intent(WelcomeLoginActivity.this, HomeActivity.class));

                        } else {

                            startActivity(new Intent(WelcomeLoginActivity.this, LoginPassWordActivity.class));
                        }
                        finish();
                    }
                });
            }
        }, 2500);
////
//            }
//        });

    }
}
